package ws.very.util.akka.cluster

import akka.actor.Actor
import akka.cluster.Cluster
import ws.very.util.lang.ShortTypes._
trait ClusterListener extends Actor {

  protected val cluster = Cluster(context.system)
  protected def listen: Seq[Class[_]]
  override def preStart(): Unit = {
    super.preStart
    cluster.subscribe(self, listen: _*)
  }
  override def postStop(): Unit = {

    cluster.unsubscribe(self)
    super.postStop
  }
}